package cn.enilu.flash.bean.entity.park;

import cn.enilu.flash.bean.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Description
 * @Author Spark
 * @Date Created in (2019/12/12 9:04)
 * @Version v1.0
 * @Modify
 **/
@Entity(name="parking_car_ref")
@Table(appliesTo = "parking_car_ref",comment = "车位客户关联")
@Data
@EntityListeners(AuditingEntityListener.class)
public class ParkingCarRef extends BaseEntity {
    @Column(name = "community_id", columnDefinition = "BIGINT COMMENT '客户ID'")
    @NotNull(message = "社区未关联")
    private Long communityId;

    @Column(name = "cust_id", columnDefinition = "BIGINT COMMENT '客户ID'")
    @NotNull(message = "客户未关联")
    private Long custId;

    @Column(name = "car_id", columnDefinition = "BIGINT COMMENT '车辆ID'")
    @NotNull(message = "车辆未关联")
    private Long carId = 0L;

    @Column(name = "parking_id", columnDefinition = "BIGINT COMMENT '车位ID'")
    @NotNull(message = "车位未关联")
    private Long parkingId;

    @Column(name = "building_id", columnDefinition = "BIGINT COMMENT '大楼ID'")
    @NotNull(message = "大楼未关联")
    private Long buildingId = 0L;

    @Column(name = "room_id", columnDefinition = "BIGINT COMMENT '房间ID'")
    @NotNull(message = "房间未关联")
    private Long roomId = 0L;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "start_date", columnDefinition = "DATETIME COMMENT '开始日期'")
    @NotNull(message = "开始日期不能为空")
    private Date startDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "end_date", columnDefinition = "DATETIME COMMENT '结束日期'")
    @NotNull(message = "结束日期不能为空")
    private Date endDate;

    @Column(name = "state", columnDefinition = "INT COMMENT '状态'")
    @NotNull(message = "状态不能为空")
    private Integer state;
}
